﻿'******************************************************
'******************************************************
'Application Title: Google Widget Editor
'version: 1.0
'Date: 01-02-2008
'Requirements: win2k or later
'Author: Andrew Pye
'Author Email: StretchMasterP@googlemail.com
'License: Released under GNU GENERAL PUBLIC LICENSE v3
'ToDo:
'Changes:Imports System.Text
'******************************************************
'******************************************************

Public Class StringReplaceTag
    Private _name As String
    Public Property Name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property

End Class
Public Class StringReplaceTags
    Inherits ObjectModel.KeyedCollection(Of String, StringReplaceTag)
    Protected Overrides Function GetKeyForItem(ByVal item As StringReplaceTag) As String
        Return item.Name
    End Function
    Public Sub AddTag(ByVal Name As String)
        If Me.Contains(Name) = False Then
            Dim oTag As New StringReplaceTag
            oTag.Name = Name
            Me.Add(oTag)
        End If
    End Sub
    ''' <summary>
    ''' Reads Content of page
    ''' </summary>
    ''' <param name="Data"></param>
    ''' <param name="ClearList"></param>
    ''' <remarks></remarks>
    Public Sub ReadTags(ByVal Data As String, ByVal ClearList As Boolean)
        Dim TagExt As New MPTools.Strings.TagExtractor()
        Dim Temp() As String = TagExt.ExtractTags(Data, "__", "__", False)
        If ClearList = True Then Me.ClearItems()
        For Each Tobj As String In Temp
            If Me.Contains(Tobj) = False Then
                Dim oTag As New StringReplaceTag
                oTag.Name = Tobj
                Me.Add(oTag)
                oTag = Nothing
            End If
           
        Next
    End Sub
End Class
